package com.robotic.videoAlarm.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.robotic.common.annotation.Log;
import com.robotic.common.core.controller.BaseController;
import com.robotic.common.core.domain.AjaxResult;
import com.robotic.common.enums.BusinessType;
import com.robotic.videoAlarm.domain.VideoAlarmCategory;
import com.robotic.videoAlarm.service.IVideoAlarmCategoryService;
import com.robotic.common.utils.poi.ExcelUtil;
import com.robotic.common.core.page.TableDataInfo;

/**
 * 视频报警类别管理Controller
 * 
 * @author tian
 * @date 2025-09-15
 */
@RestController
@RequestMapping("/admin/videoAlarm")
public class VideoAlarmCategoryController extends BaseController
{
    @Autowired
    private IVideoAlarmCategoryService videoAlarmCategoryService;

    /**
     * 查询视频报警类别管理列表
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:list')")
    @GetMapping("/list")
    public TableDataInfo list(VideoAlarmCategory videoAlarmCategory)
    {
        startPage();
        List<VideoAlarmCategory> list = videoAlarmCategoryService.selectVideoAlarmCategoryList(videoAlarmCategory);
        return getDataTable(list);
    }

    /**
     * 导出视频报警类别管理列表
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:export')")
    @Log(title = "视频报警类别管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, VideoAlarmCategory videoAlarmCategory)
    {
        List<VideoAlarmCategory> list = videoAlarmCategoryService.selectVideoAlarmCategoryList(videoAlarmCategory);
        ExcelUtil<VideoAlarmCategory> util = new ExcelUtil<VideoAlarmCategory>(VideoAlarmCategory.class);
        util.exportExcel(response, list, "视频报警类别管理数据");
    }

    /**
     * 获取视频报警类别管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(videoAlarmCategoryService.selectVideoAlarmCategoryById(id));
    }

    /**
     * 新增视频报警类别管理
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:add')")
    @Log(title = "视频报警类别管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody VideoAlarmCategory videoAlarmCategory)
    {
        return toAjax(videoAlarmCategoryService.insertVideoAlarmCategory(videoAlarmCategory));
    }

    /**
     * 修改视频报警类别管理
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:edit')")
    @Log(title = "视频报警类别管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody VideoAlarmCategory videoAlarmCategory)
    {
        return toAjax(videoAlarmCategoryService.updateVideoAlarmCategory(videoAlarmCategory));
    }

    /**
     * 删除视频报警类别管理
     */
    @PreAuthorize("@ss.hasPermi('admin:videoAlarm:remove')")
    @Log(title = "视频报警类别管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(videoAlarmCategoryService.deleteVideoAlarmCategoryByIds(ids));
    }
}
